#pragma once

#include <QString>
#include <Bnd_Box.hxx>
#include <gp_Pnt.hxx>
#include <AIS_InteractiveObject.hxx>
#include <AIS_Shape.hxx>
#include <TDF_Label.hxx>
#include <QVector>
#include <Quantity_Color.hxx>
#include <Standard_Version.hxx>
#include <XCAFDoc_ColorTool.hxx>
#include <XCAFDoc_ShapeTool.hxx>
#include <XCAFDoc_LayerTool.hxx>
#include <XCAFDoc_Material.hxx>
#include <XCAFDoc_MaterialTool.hxx>
#include <XCAFDoc_VisMaterialTool.hxx>

namespace Utils {

QString ConvertPath(QString &originPath);

struct BndUtils {
    static void add(Bnd_Box* box, const Bnd_Box& other);
    static bool isOpen(const Bnd_Box& bndBox);
    static bool hasFinitePart(const Bnd_Box& bndBox);
    static Bnd_Box finitePart(const Bnd_Box& bndBox);
    static Bnd_Box AisObject_boundingBox(const Handle(AIS_InteractiveObject)& object);
};

struct BndBoxCoords {
    double xmin;
    double ymin;
    double zmin;
    double xmax;
    double ymax;
    double zmax;

    gp_Pnt center() const;
    std::array<gp_Pnt, 8> vertices() const;
    gp_Pnt minVertex() const;
    gp_Pnt maxVertex() const;
    static BndBoxCoords get(const Bnd_Box& box);
};

class XCaf {
public:
    static TopLoc_Location shapeAbsoluteLocation(TDF_Label& rootNodeLabel, TDF_Label& nodeLabel);
    static TopLoc_Location shapeReferenceLocation(const TDF_Label& lbl);
private:
    XCaf() = default;
};

struct GraphicsEntity {
    struct Object {
        Handle(AIS_Shape) aisShape;
        gp_Trsf trsfOriginal;
        Bnd_Box bndBox;
        TDF_Label tdfLabel;
    };
    QVector<Object> vecObject;
    Bnd_Box bndBox;
    TDF_Label tdfLabel;
};

}
